package com.teamone.etl.enterprise.entity;

import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.teamone.etl.exception.CommonCode;
import com.teamone.etl.exception.CustomException;
import com.teamone.etl.util.VerifyUtil;
import java.io.Serializable;
import org.apache.commons.lang3.StringUtils;

/**
 预警号码(AlarmPhone)表实体类

 @author makejava
 @since 2021-01-21 11:30:09 */
public class AlarmPhone extends Model<AlarmPhone> {
    /**
     主键id
     */
    private Integer id;
    /**
     企业id
     */
    private Integer enterpriseId;
    /**
     预警号码
     */
    private String phone;
    /**
     姓名
     */
    private String name;

    public void verify() throws CustomException {
        boolean flag = phone != null && VerifyUtil.phone(phone);
        if(!flag){
            throw new CustomException(CommonCode.ENTERPRISE_MOBILE_INVALID);
        }
        flag = StringUtils.isEmpty(name);
        if(!flag){
            throw new CustomException(CommonCode.ENTERPRISE_PEOPLE_INVALID);
        }
    }


    public Integer getId () {
        return id;
    }

    public void setId (Integer id) {
        this.id = id;
    }

    public Integer getEnterpriseId () {
        return enterpriseId;
    }

    public void setEnterpriseId (Integer enterpriseId) {
        this.enterpriseId = enterpriseId;
    }

    public String getPhone () {
        return phone;
    }

    public void setPhone (String phone) {
        this.phone = phone;
    }

    public String getName () {
        return name;
    }

    public void setName (String name) {
        this.name = name;
    }

    /**
     获取主键值

     @return 主键值
     */
    @Override
    protected Serializable pkVal () {
        return this.id;
    }
}